﻿@model PagedList.IPagedList<VehicleOOBWeb.Models.Vehicle>

@{
    ViewBag.Title = "Quản lý thông tin mua bán xe";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


@section featured {
    <div class="header2">
        <img class="right" src="/images/heder_bg.gif" alt="" />
        <h2 class="header2">Quản lý thông tin các xe bày bán</h2>
    </div>
}
<p>
    @Html.ActionLink("Thêm mới xe", "Create")
</p>
<table class="tbInherit">
    <tr>
        <th>
            Tên
        </th>
        <th>
            Giá
        </th>
        <th>
            Số lượng
        </th>
        <th>
            Mô tả
        </th>
        <th>
            Ngày sản xuất
        </th>
        <th>
            Hãng Xe
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.price)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.quantity)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.description)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.release_date)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Manufacturer.manufacturer_name)
            </td>
            <td>
                <a href="/Vehicle/Edit/@item.vehicle_id">
                    <img src='/Images/icon-edit.gif' alt='edit' />
                </a>

                <a href="/Vehicle/Delete/@item.vehicle_id">
                    <img src='/Images/icon-del.png' alt='del' />
                </a>
            </td>
        </tr>
    }

</table>



@if (Model.PageCount > 1)
{
    @:<div class="pager">
@:Trang 
        if (Model.HasPreviousPage)
        {
            @Html.ActionLink("<<", "Manager", new { page = 1 })
            @Html.Raw(" ");
            @Html.ActionLink("<", "Manager", new { page = Model.PageNumber - 1 })
            @Html.Raw(" ");
        }
        else
        {
            @:<<
            @Html.Raw(" ");
            @:<   
        }
        @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) @Html.Raw("/") @Model.PageCount

        if (Model.HasNextPage)
        {
            @Html.Raw(" "); 
            @Html.ActionLink(">", "Manager", new { page = Model.PageNumber + 1 })
            @Html.Raw(" "); 
            @Html.ActionLink(">>", "Manager", new { page = Model.PageCount })
        }
        else
        {
            @:>
            @Html.Raw(" ")
            @:>>   
        }
    @:</div>
    }
